package org.springframework.boot;

import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.core.env.PropertySource;
import org.springframework.core.env.SimpleCommandLinePropertySource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.ResourcePropertySource;
import zcj.stu.User;

public class Step6 {
    public static void main(String[] args) throws Exception{
        ApplicationEnvironment env = new ApplicationEnvironment();
        env.getPropertySources().addLast(new ResourcePropertySource("step6",new ClassPathResource("application.properties")));
        User user = Binder.get(env).bind("zcj", User.class).get();
        System.out.println(user);
        User user1=new User();
        user1.setFirstName("zzccjj");
        Binder.get(env).bind("zcj", Bindable.ofInstance(user1));
        System.out.println(user1);
    }
}